home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0021_Multiple Dir Picks.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  3KB  |  112 lines

  1. {
  2. DAVID DRZYZGA
  3.  
  4. > And I can't seem to get the OpDir system to work With multiple Files, or
  5. > at least I can't get the "tagging" Function to work.
  6.  
  7. Here's a somewhat stripped snipit of code from one of my apps that will give
  8. you a clear example of how to use the multiple pick Function of the DirList
  9. Object:
  10. }
  11.  
  12. Program DirTest;
  13.  
  14. {$I OPDEFINE.INC}
  15.  
  16. Uses
  17.   Dos,
  18.   OpRoot,
  19.   OpConst,
  20.   OpString,
  21.   OpCrt,
  22.   OpCmd,
  23.   OpFrame,
  24.   OpWindow,
  25.   OpPick,
  26.   OpDir,
  27.   OpColor;
  28.  
  29. Const
  30.   SliderChar    = '▓';
  31.   ScrollBarChar = '░';
  32.   Frame1        : FrameArray = '┌└┐┘──││';
  33.   Counter       : Word = 1;
  34.  
  35. Var
  36.   Dir          : DirList;
  37.   Finished     : Boolean;
  38.   SelectedItem : Word;
  39.   DirWinOpts   : LongInt;
  40.   I            : Integer;
  41.  
  42. Procedure ProcessFile(FileName : String);
  43. begin
  44.   {This is where you would process each of the tagged Files}
  45. end;
  46.  
  47. begin
  48.   DirWinOpts := DefWindowOptions+wBordered;
  49.   if not Dir.InitCustom(20, 4, 50, 19, {Window coordinates}
  50.                         DefaultColorSet,  {ColorSet}
  51.                         DirWinOpts,    {Window options}
  52.                         MaxAvail,      {Heap space For Files}
  53.                         PickVertical,  {Pick orientation}
  54.                         MultipleFile)  {Command handler}
  55.   then
  56.   begin
  57.     WriteLn('Failed to Init DirList,  Status = ', InitStatus);
  58.     Halt;
  59.   end;
  60.  
  61.   {Set desired DirList features}
  62.   With Dir do
  63.   begin
  64.     wFrame.AddShadow(shBR, shSeeThru);
  65.     wFrame.AddCustomScrollBar(frRR, 0, MaxLongInt, 1, 1, SliderChar,
  66.                               ScrollBarChar, DefaultColorSet);
  67.  
  68.     SetSelectMarker(#251' ', '');
  69.     SetPosLimits(1, 1, ScreenWidth, ScreenHeight-1);
  70.     SetPadSize(1, 1);
  71.     diOptionsOn(diOptimizeSize);
  72.     AddMaskHeader(True, 1, 30, heTC);
  73.     SetSortOrder(SortDirName);
  74.     SetNameSizeTimeFormat('<dir>', 'Mm/dd/yy', 'Hh:mmt');
  75.     SetMask('*.*', AnyFile);
  76.   end;
  77.  
  78.   {<AltP>: process selected list}
  79.   PickCommands.AddCommand(ccUser0, 1, $1900, 0);
  80.  
  81.   {Pick Files}
  82.   Finished := False;
  83.   Repeat
  84.     Dir.Process;
  85.     Case Dir.GetLastCommand of
  86.       ccSelect : ;
  87.       ccError  : ;
  88.       ccUser0  :
  89.       begin
  90.         Counter := 1;
  91.         if Dir.GetSelectedCount > 0 then
  92.         begin
  93.           Dir.InitSequence(SelectedItem);
  94.           While Dir.HaveSelected(SelectedItem) do
  95.           begin
  96.             ProcessFile(Dir.GetMultiPath(SelectedItem));
  97.             Inc(Counter);
  98.             Dir.NextSelected(SelectedItem);
  99.             Dir.ResetList;
  100.           end;
  101.         end
  102.       end;
  103.  
  104.       ccQuit : Finished := True;
  105.     end;
  106.   Until Finished;
  107.  
  108.   Dir.Erase;
  109.   ClrScr;
  110.   Dir.Done;
  111. end.
  112.